<%@ page language="java" import="java.util.*, cn.boho.framework.core.*,cn.boho.framework.actions.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
Object obj=session.getAttribute("hmSessionData");
if(obj==null){
	out.println("obj is null");
}else{
	HashMap hm=(HashMap)obj;
	out.println("obj size="+hm.size());
}	
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

  <head>
    <base href="<%=basePath%>"/>
    
    <title>测试Action的主页</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
	<meta http-equiv="pragma" content="no-cache"/>
	<meta http-equiv="cache-control" content="no-cache"/>
	<meta http-equiv="expires" content="0"/>    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>

	

<script type="text/javascript">
function fun1(){
	var mywin=document.getElementById("mywin");
	var action=document.getElementById("action");
	var channel=document.getElementById("channel");
	mywin.src="r.jsp?action="+action.value+"&channel="+channel.options[channel.selectedIndex].value;
	funAddList(action.value);
}

function funAddList(sValue){
	//将请求过的Action添加到 actionlist中
	var actionlist=document.getElementById("actionlist");
	var blnStatus=false;
	for(i=0;i<actionlist.options.length;i++){
		if(actionlist.options[i].value==sValue){
			blnStatus=true;
		}
	}
	if(!blnStatus){
		var oOption = document.createElement("option")
		oOption.value=sValue;
		oOption.text=sValue;
		actionlist.options.add(oOption);
	}
}
function fun2(key){

	var mywin=document.getElementById("mywin");
	//var action=document.getElementById("action");
	var channel=document.getElementById("channel");
	//mywin.src="r.jsp?action="+action.value+"&channel="+channel.options[channel.selectedIndex].value;
	mywin.src="r.jsp?action="+key+"&channel="+channel.options[channel.selectedIndex].value;

	funAddList(key);
}

function fun3(obj){
	var firsttd=document.getElementById("firsttd");
	if(firsttd.style.display=="" || firsttd.style.display=="block"){
		firsttd.style.display="none";
		obj.value="缩小";
	}else{
		firsttd.style.display="block";
		obj.value="放大";
	}
}
function fun4(obj){
	var action=document.getElementById("action");
	action.value=obj.options[obj.selectedIndex].value;
	fun1();
}
</script>
  </head>
  
  <body>
  <table width="98%" border="1">
  <tr>
    <td width="43%" valign="top" id="firsttd">
    <table>
        <tr valign="top">
    		<td valign="top">通道名称:&nbsp;&nbsp;
    			<select name="select" id="channel" name="channel">
				  <option value="json">json</option>
			  	  <option value="xml" selected="selected">xml</option>
			  	  <option value="mobile">mobile</option>
			  	</select>
			  	Action列表:&nbsp;&nbsp;
			  	<select name="select" id="actionlist" name="actionlist" onchange="fun4(this);">
				  
			  	</select>
		    </td>
    	</tr>
    	<tr valign="top">
    		<td valign="top">Action名称:<input type="text" name="action" id="action" value="" size="50" /><input type="button" onclick="fun1()" value="请求" /></td>
    	</tr>
    	<tr valign="top">
    		<td>
    		    <%
    Set set=FrameworkConstant.hmAction.entrySet();
    for(Iterator I=set.iterator();I.hasNext();){
    	java.util.Map.Entry entry=(java.util.Map.Entry)I.next();
    	Object key=entry.getKey();
    	Object value=entry.getValue();
    	ActionBean ab =(ActionBean) value;
    	
    	%>
    	<a href="t.jsp#" title="<%=ab.getDescription()%>" onclick="fun2('<%=key%>')" ><%=key%></a><br/>
    	<%
    }
     %>
    		
    		</td>
    	</tr>
    </table>
    </td>
    <td width="57%" valign="top"><input type="button" value="放大" onclick="fun3(this);"/><br/><br/><iframe name="mywin" id="mywin" width="100%" height="500" scrolling="auto"/></td>
  </tr>
</table>
  
  
    

  </body>
</html>
